{% extends "edit/edit-base.html" %} 
{% block content %}
 <table class="table table-striped">
      <thead>
        <tr>
          <th>#</th>
          <th>评论内容</th>
          <th>文章</th>
          <th>留言者</th>
          <th>时间</th>
          <th>@</th>
        </tr>
      </thead>
      <tbody>
      {% if comment_list %}
		{% for comment in comment_list %}
        <tr>
          <td>{{comment.id}}</td>
          <td>{{comment.message}}</td>
          <td><a href="{% url 'blog' comment.blog_id%}" title="查看原文">_{{comment.blog_id}}_</a></td>
          <td><a href="{{comment.website}}" target="_blank" >@{{comment.name}}</a></td> 
          <td>{{ comment.time|date:"Y-m-d" }}</td>
          <td class="delete"><a href="#" id="{{comment.id}}" TITLE="删除"><img  src="/images/delete.png" height="20" width="20"></a></td>
          
        </tr>
        {% endfor%}
        {%endif%}
      </tbody>
    </table>
    <!-- pagination -->
 	<nav>
        <ul class="pager">
        {% if comment_list.has_previous %}
          <li><a href="{{ query }}&pn={{ comment_list.previous_page_number }}">上一页</a></li>
        {% endif %}
		{% if comment_list.has_next %}
          <li><a href="{{ query }}&pn={{ comment_list.next_page_number  }}">下一页</a></li>
        {% endif %}
        </ul>
    </nav>
    
<script type="text/javascript">
function deleteComment(id){
	$.post("/edit/delete_message/", {id:id}, function (result) { 
		if(result=="success"){
		//	alert("删除成功。。。");
			window.location.href='/edit/get_message_list';
		}
	});
}
$(document).ready(function(){

	//发布文章
	  $(".delete a ").click(function(){
		var id = $(this).attr("id");
		if( confirm("确认删除当前留言。。。")){
			deleteComment(id);
		}
	  });

		  
	});
</script>
{% endblock %}
